package com.employeemanagementsystem.controller;

import com.employeemanagementsystem.dao.FeedbackDao;
import com.employeemanagementsystem.model.User;

import jakarta.servlet.http.HttpSession;
import jakarta.servlet.ServletException;
import jakarta.servlet.annotation.WebServlet;
import jakarta.servlet.http.HttpServlet;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebServlet("/process_feedback")
public class FeedbackProcessServlet extends HttpServlet {
    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        int feedbackId = Integer.parseInt(request.getParameter("feedbackId"));
        String responseContent = request.getParameter("response");

        FeedbackDao feedbackDao = new FeedbackDao();
        if (feedbackDao.updateFeedbackStatus(feedbackId, responseContent)) {
            response.sendRedirect("admin_home?message=Feedback processed successfully!");
        } else {
            response.sendRedirect("admin_home?error=Failed to process feedback.");
        }
    }
}
